package com.unicomcz.query;

import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.List;

import com.unicomcz.DetailPageAction;

public class CardActiveDetailAction extends DetailPageAction
{
    private String productName="";
    
    public String getProductName()
    {
        return productName;
    }
    public void setProductName(String productName)
    {
        this.productName = productName;
    }
    public String getSqlStr() {
        String sqlStr="SELECT acct_month 月份,serial_number 号码,active_time 激活时间,parent_markname 品牌,product_name 套餐  " + 
                " FROM dls_detail_score where depart_code=? and acct_month=? and product_id=?" +
                " order by active_time,serial_number";
        return sqlStr;
    }
    public Object[] getParams() {
        log.debug(acctMonth);
        log.debug(userInfo.getDepartCode());
        log.debug(productName);
        return new Object[]{userInfo.getDepartCode(),acctMonth,productName};
    }
    protected void regQueryParam() throws Exception{
        if ((acctMonth==null)||(acctMonth.length()==0)) {
            SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM");
            acctMonth=sf.format(new java.util.Date());
        }
        pstmt.setString(1, userInfo.getDepartCode());
        pstmt.setString(2, acctMonth);
        pstmt.setString(3, productName);
    }
    protected void rs2List(ResultSet rs,List out) throws Exception{
        DetailCardActive t = new DetailCardActive();
        t.setAcctMonth(rs.getString(1));
        t.setSerialNumber(rs.getString(2));
        t.setOpenTime(rs.getString(3));
        t.setBrand(rs.getString(4));   
        t.setBrandSub(rs.getString(5));
        out.add(t);
    }

}
